﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Project.Ycm20250401.Service
{
    /// <summary>
    /// 
    /// </summary>
    public class CabinetService
    {
        private readonly ICabinetFactory _factory;

        public CabinetService(ICabinetFactory factory)
        {
            _factory = factory;
        }

        public async Task OperateCabinet(string cabinetType, int cabinetId, Action<ICabinetFunction> operation)
        {
            var cabinet = _factory.CreateCabinet(cabinetType);
            try
            {
                await cabinet.OpenDoorAsync(cabinetId);
            }
            catch (Exception ex)
            {

            }
        }
    }
}
